package es.mfp.practicos.view;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

/**
 * metodos de utilidad comunes a todos los viewbean
 * 
 * @author moi
 * 
 */
public abstract class ViewBean {

	protected void addMessage(String message) {
		FacesContext context = FacesContext.getCurrentInstance();
		context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, message, null));
	}

	protected void addWarning(String message) {
		FacesContext context = FacesContext.getCurrentInstance();
		context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, message, null));
	}

	protected void addError(String message) {
		FacesContext context = FacesContext.getCurrentInstance();
		context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, message, null));
	}

}
